<!DOCTYPE html>
<script src="../../../resources/js-test.js"></script>
<iframe></iframe>
<script>

description('Tests that moving an element between documents with different quirks mode works');

var htmlElement = document.createElement('div');
htmlElement.className = "A a B";

debug('In standards mode');
shouldBeTrue('htmlElement.classList.contains("A")');
shouldBeTrue('htmlElement.classList.contains("a")');
shouldBeTrue('htmlElement.classList.contains("B")');
shouldBeFalse('htmlElement.classList.contains("b")');

var doc = frames[0].document;
doc.open();
doc.write('<body></body>');
doc.close();

debug('Moved to quirks mode');
doc.body.appendChild(htmlElement);
shouldBeTrue('htmlElement.classList.contains("A")');
shouldBeTrue('htmlElement.classList.contains("a")');
shouldBeTrue('htmlElement.classList.contains("B")');
shouldBeFalse('htmlElement.classList.contains("b")');

debug('Moved back to standards mode');
document.body.appendChild(htmlElement);
shouldBeTrue('htmlElement.classList.contains("A")');
shouldBeTrue('htmlElement.classList.contains("a")');
shouldBeTrue('htmlElement.classList.contains("B")');
shouldBeFalse('htmlElement.classList.contains("b")');

</script>
